package com.heima.model.behavior.pojos;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;

/**
 * @Author XHui
 * @Since 2024/3/3 16:33
 * @Version 1.0
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Document("ap_collection_behavior")
public class ApCollectionBehavior extends ApBaseBehavior {
    private Short type;
    private Date collectionTime;
    private Date publishedTime;

    public enum Type {
        ARTICLE((short) 0), DYNAMIC((short) 1);
        short code;

        Type(short code) {
            this.code = code;
        }

        public short getCode() {
            return this.code;
        }
    }

    public enum Operation {
        COLLECTION((short) 0), CANCEL_COLLECTION((short) 1);
        short code;

        Operation(short code) {
            this.code = code;
        }

        public short getCode() {
            return this.code;
        }
    }

    public boolean isCollectionArticle() {
        return (this.getType() != null && this.getType().equals(Type.ARTICLE.code));
    }
}


